import {defineConfig} from 'vite'
import vue from '@vitejs/plugin-vue'
import path from "path"

export default defineConfig({
    plugins: [vue()],
    resolve:{
        alias: {
            '@': path.resolve('./src') //该配置在打包时会导致图片无法正常显示，对于图片得使用相对路径
        }
    },
    server: {
        port: 8080,
        host: '0.0.0.0',
        // 设置代理
        proxy: {
            '/api': {
                target: 'http://localhost:9000',
                changeOrigin: true,
                ws: true,
                rewrite: (path) => path.replace(/^\/api/, '')
            },
            '/imageModule': {
                target: 'http://localhost:9001',
                changeOrigin: true,
                ws: true,
                rewrite: (path) => path.replace(/^\/imageModule/, '')
            }
        }
    },
    build: {
        chunkSizeWarningLimit: 5000,
    }
})
